Skip to content

Refactor InterfaceGenerator into composable method generators#1147

Merged
christianhelle merged 3 commits into
mainfrom
deepen-interface-generator
Jun 14, 2026
Merged

Refactor InterfaceGenerator into composable method generators#1147
christianhelle merged 3 commits into
mainfrom
deepen-interface-generator

Conversation

@christianhelle

@christianhelle christianhelle commented Jun 14, 2026

Copy link
Copy Markdown
Owner

Summary

Deepens the InterfaceGenerator module by extracting three focused generators, each independently testable. The public API is unchanged — all existing tests (2184) pass.

Changes

  • IReturnTypeGenerator/ReturnTypeGenerator — return type derivation, IApiResponse wrapping, Task/IObservable selection, file stream detection, response type override
  • IMethodAttributeGenerator/MethodAttributeGenerator — Accept/Content-Type/Authorization headers, [Multipart], [Obsolete]
  • IMethodSignatureGenerator/MethodSignatureGenerator — parameter aggregation (delegates to ParameterAggregator), optional parameter reordering, dynamic querystring
  • IMethodGenerator/MethodGenerator — facade composing the three sub-generators
  • InterfaceGenerator — reduced from 450→253 lines by delegating to IMethodGenerator

Module Structure

IMethodGenerator
├── IReturnTypeGenerator      — return type derivation
├── IMethodAttributeGenerator — method-level attributes
├── IMethodSignatureGenerator — method name + parameters
└── InterfaceGenerator (deepened, delegates to IMethodGenerator)

Testing

25 new unit tests across the three generators (ReturnTypeGeneratorTests, MethodAttributeGeneratorTests, MethodSignatureGeneratorTests). All 2184 existing tests pass unchanged.

…dSignatureGenerator, and IMethodGenerator

InterfaceGenerator reduced from 450 to 253 lines by extracting:
- ReturnTypeGenerator: return type derivation, IApiResponse wrapping, Task/IObservable
- MethodAttributeGenerator: Accept/Content-Type/Authorization headers, [Multipart], [Obsolete]
- MethodSignatureGenerator: parameter aggregation (delegates to ParameterAggregator)
- MethodGenerator: facade composing the three sub-generators

Public API unchanged. All existing tests continue to work.
…r, and MethodSignatureGenerator

- ReturnTypeGeneratorTests: 10 tests covering return type derivation,
  IApiResponse wrapping, Task/IObservable selection, file stream responses,
  response type override, IsApiResponseType
- MethodAttributeGeneratorTests: 8 tests covering Accept/Content-Type/
  Authorization headers, [Multipart], [Obsolete], and combinations
- MethodSignatureGeneratorTests: 7 tests covering parameter aggregation,
  CancellationToken, dynamic querystring, Apizr RequestOptions
@christianhelle christianhelle self-assigned this Jun 14, 2026
@christianhelle christianhelle added .NET Pull requests that contain changes to .NET code enhancement New feature, bug fix, or request labels Jun 14, 2026
@coderabbitai

coderabbitai Bot commented Jun 14, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@christianhelle, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 29 minutes and 39 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 0730691f-ac26-4a28-8139-30e97e8d0827

📥 Commits

Reviewing files that changed from the base of the PR and between e819ceb and 7114bfe.

📒 Files selected for processing (13)
  • docs/prd/prd-04-deepen-interface-generator.md
  • src/Refitter.Core/IMethodAttributeGenerator.cs
  • src/Refitter.Core/IMethodGenerator.cs
  • src/Refitter.Core/IMethodSignatureGenerator.cs
  • src/Refitter.Core/IReturnTypeGenerator.cs
  • src/Refitter.Core/InterfaceGenerator.cs
  • src/Refitter.Core/MethodAttributeGenerator.cs
  • src/Refitter.Core/MethodGenerator.cs
  • src/Refitter.Core/MethodSignatureGenerator.cs
  • src/Refitter.Core/ReturnTypeGenerator.cs
  • src/Refitter.Tests/MethodAttributeGeneratorTests.cs
  • src/Refitter.Tests/MethodSignatureGeneratorTests.cs
  • src/Refitter.Tests/ReturnTypeGeneratorTests.cs
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch deepen-interface-generator

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@sonarqubecloud

Copy link
Copy Markdown

@codecov

codecov Bot commented Jun 14, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.64706% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 94.38%. Comparing base (25407ad) to head (7114bfe).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/Refitter.Core/ReturnTypeGenerator.cs 96.29% 0 Missing and 3 partials ⚠️
src/Refitter.Core/InterfaceGenerator.cs 96.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1147      +/-   ##
==========================================
+ Coverage   94.31%   94.38%   +0.06%     
==========================================
  Files          48       52       +4     
  Lines        2796     2847      +51     
==========================================
+ Hits         2637     2687      +50     
- Misses         53       54       +1     
  Partials      106      106              
Flag Coverage Δ
unittests 94.38% <97.64%> (+0.06%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@christianhelle christianhelle changed the title refactor: deepen InterfaceGenerator into composable method generators Refactor InterfaceGenerator into composable method generators Jun 14, 2026
@christianhelle
christianhelle merged commit 616e439 into main Jun 14, 2026
15 checks passed
@christianhelle
christianhelle deleted the deepen-interface-generator branch June 14, 2026 23:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature, bug fix, or request .NET Pull requests that contain changes to .NET code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant